Skip to content

add parameter to deploy new unified environment in early release cycle #128 - #131

Open
FH-Inway wants to merge 9 commits into
d365collaborative:developmentfrom
FH-Inway:support-early-release-cycle-cluster-128
Open

add parameter to deploy new unified environment in early release cycle #128#131
FH-Inway wants to merge 9 commits into
d365collaborative:developmentfrom
FH-Inway:support-early-release-cycle-cluster-128

Conversation

@FH-Inway

@FH-Inway FH-Inway commented Aug 13, 2026

Copy link
Copy Markdown
Member

This pull request adds support for creating early release environments in the New-UnifiedEnvironment PowerShell function. The main changes introduce a new -EarlyRelease switch parameter, update documentation and examples, and ensure the early release option is properly handled in the environment creation payload.

implements #128

@FH-Inway FH-Inway changed the title add parameter to deploy new unified environment in early release cycle add parameter to deploy new unified environment in early release cycle #128 Aug 13, 2026
@FH-Inway
FH-Inway requested a balanced review from Copilot August 13, 2026 18:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds early-release-cycle provisioning support to New-UnifiedEnvironment.

Changes:

  • Adds the -EarlyRelease switch and help example.
  • Adds cluster.category = "FirstRelease" to creation payloads.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

[switch] $WaitForCompletion
[switch] $WaitForCompletion,

[switch] $EarlyRelease
Comment on lines +325 to +330
if ($EarlyRelease.IsPresent) {
$config.properties | `
Add-Member -MemberType NoteProperty `
-Name cluster `
-Value ([PsCustomObject][ordered]@{
category = "FirstRelease"
Comment thread d365bap.tools/functions/New-UnifiedEnvironment.ps1 Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@FH-Inway
FH-Inway requested a review from Splaxi August 13, 2026 18:12
@FH-Inway FH-Inway self-assigned this Aug 13, 2026
@FH-Inway FH-Inway added the enhancement New feature or request label Aug 13, 2026
@FH-Inway

Copy link
Copy Markdown
Member Author

@Splaxi I have another version that uses the api.powerplatform.com API here: FH-Inway@f068105

Since that API is documented, I would rather use it. However, it introduces an unrelated change for the parameter region, which is now called Macro Region instead of Azure Region. It also cannot be used together with location and it seems to be a tenant setting if it can be used at all (see https://learn.microsoft.com/en-us/rest/api/power-platform/environmentmanagement/environment-provisioning/get-supported-locations). Let me know if that is a blocker for you, otherwise I would prepare the api.powerplatform.com version for merge.

I also noticed there is no workflow yet to update the documentation and signature tests like there is for d365fo.tools. Anything I should know before trying to add it?

-Value $SecurityGroupId
}

if ($EarlyRelease.IsPresent) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I remember at IsPresent will actually trigger - if you do EarlyRelease:$false

Normal if - just on the var is what we are after.

Make a local test function - and prove me wrong 😉

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot gave me this, which convinces me:

function Test-EarlyReleaseSwitch {
    param(
        [switch] $EarlyRelease
    )

    $result = [ordered]@{
        IsPresent = $EarlyRelease.IsPresent
        ToString  = $EarlyRelease.ToString()
    }

    [pscustomobject]$result
}

Write-Host "No switch passed:"
Test-EarlyReleaseSwitch

Write-Host "Switch passed explicitly false:" 
Test-EarlyReleaseSwitch -EarlyRelease:$false

Write-Host "Switch passed explicitly true:" 
Test-EarlyReleaseSwitch -EarlyRelease:$true

Output:

No switch passed:

Switch passed explicitly false:
Switch passed explicitly true:
IsPresent ToString
--------- --------
    False False
    False False
     True True

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But yeah, let me remove it, doesn't make sense in this context.

PostProvisionDelaySeconds = $PostProvisionDelaySeconds
ReadyStateTimeoutMinutes = $ReadyStateTimeoutMinutes
ReadyStateTimeoutMinutes = $ReadyStateTimeoutMinutes
EarlyRelease = $EarlyRelease.IsPresent

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsPresent was discussed further down - this might not be what you are after

@Splaxi

Splaxi commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

I'm not sure.

We are focused on getting things to west europe - so that why we have the current support for that. If the new API - it the "right" one to use, and we lose that option - then maybe that is what we should support.

What does your gut feeling say ?

@FH-Inway

Copy link
Copy Markdown
Member Author

My gut feeling says I should not trust my gut on this 😄
This seems to be a new concept that is still evolving, so I have to do some reading.

However, my test environments that I deployed using api.powerplatform.com give me a weird redirect error when trying to access the D365FO url. So either something is missing or the API is not yet fit for duty.

https://gw.eu-il301.gateway.prod.island.powerapps.com/replyurl/v1
Redirect invalid. Correlation id 8a3135f7-c2be-42f1-8184-f93c409f27a1. Timestamp 2026-08-14 09:22:37Z. Error code 1011.

@Splaxi

Splaxi commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Let's stick with what we have for now 😉

Block   : [-] Validating PS1 Script files
Name    : It [internal\functions\Update-PsfConfigVariables.ps1] Should have UTF8 encoding with Byte Order Mark
Result  : Failed
Message : Expected strings to be the same, but they were different.
          Expected length: 8
          Actual length:   7
          Strings differ at index 1.
          Expected: 'UTF8 BOM'
          But was:  'Unknown'
                     -^
On Windows PowerShell, the common parameter ProgressAction is not available, which causes a lot of errors during validation.

Block   : [-] Ensuring unchanged command signature
Name    : It Should have the expected parameter ProgressAction
Result  : Failed
Message : Expected 'ProgressAction', but got $null.
@FH-Inway
FH-Inway marked this pull request as ready for review August 14, 2026 15:44
@FH-Inway

Copy link
Copy Markdown
Member Author

Ok, here we go.

The cleanup was a bit of a pain, since no scripts to format the comment based help or update the unit tests and docs existed. I copied them over from d365fo.tools. Since they are pretty stable, I think we can live with the redundancy.
The validate workflow currently runs mostly on Windows PowerShell, which was an issue for the individual unit tests. I switched it to PowerShell 7, but we probably want all tests to run in that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: New-UnifiedEnvironment should have parameter to provision environment in the Early Release Cycle

3 participants